﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EntityModel;
using Services;

namespace ShopWeb.Controllers
{
    public class CommonController : Controller
    {
        #region 公共属性
        private WebConfigService webConfigService = new WebConfigService();
        private ArticleService articleService = new ArticleService();
        private CategoryService categoryService = new CategoryService();
        #endregion

        public ActionResult _Home()
        {
            WebConfig webConfig = webConfigService.GetModel();
            ViewData["webConfig"] = webConfig;
            return View();
        }
        public ActionResult _Footer()
        {
            ViewData["About"] = articleService.GetListByCategoryId(7);
            ViewData["Novice"] = articleService.GetListByCategoryId(8);
            ViewData["Member"] = articleService.GetListByCategoryId(9);
            ViewData["Pay"] = articleService.GetListByCategoryId(10);
            ViewData["Service"] = articleService.GetListByCategoryId(11);
            return View();
        }

        public ActionResult CategoryById(int cId)
        {
            ViewData["categoryList"] = categoryService.GetListById(cId);
            Category model= categoryService.GetParentCategoryName(cId);
            ViewData["cId"] = cId;
            return View(model);
        }

    }
}
